package org.sy.lab.多线程基础._1_管理._4_异常捕获.Future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

public class Main {

	public static void main(String[] args) {
		
		MyThread myThread = new MyThread();
		FutureTask<Integer> result = new FutureTask<Integer>(myThread);
		Thread thread = new Thread(result);
		thread.start();
		
		try {
			TimeUnit.SECONDS.sleep(3);
			System.out.println(result.get());
		} catch (InterruptedException | ExecutionException e) {
			System.out.println("捕获到异常");
			e.printStackTrace();
		}
	}
}
